import { $get } from '@js/authRequest'

// 获取延期审限案件列表
export async function getData (current, pageSize, orderField, order, condition) {
  const c = JSON.parse(JSON.stringify(condition))
  c.forEach(li => {
    li.k = `c.${li.k}`
  })
  const params = {
    current,
    page_size: pageSize,
    condition: JSON.stringify(c)
  }
  if (orderField && order) {
    params.order = order === 'ascend' ? 'asc' : 'desc'
    params.order_field = orderField
  }
  const res = await $get('/api/mgt/case', {
    params
  })
  if (res.status !== 1) {
    throw new Error(res.message)
  }
  return res.data
}
